/**
 * &copy; 2006 NewInstance.it
 */
package it.newinstance.util;

import java.io.Serializable;

/**
 * @author Luigi R. Viggiano
 * @version $Id: LabelValueBean.java 138 2007-06-12 12:23:29Z luigi.viggiano $
 */
public class LabelValueBean implements Serializable {
    private static final long serialVersionUID = -137687199102921991L;
    private final String label;
    private final String value;
    
    public LabelValueBean(String label, String value) {
        this.label = label;
        this.value = value;
    }

    public String getLabel() {
        return label;
    }
    
    public String getValue() {
        return value;
    }

    @Override
    public int hashCode() {
        final int PRIME = 31;
        int result = 1;
        result = PRIME * result + ((label == null) ? 0 : label.hashCode());
        result = PRIME * result + ((value == null) ? 0 : value.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        final LabelValueBean other = (LabelValueBean) obj;
        if (label == null) {
            if (other.label != null)
                return false;
        } else if (!label.equals(other.label))
            return false;
        if (value == null) {
            if (other.value != null)
                return false;
        } else if (!value.equals(other.value))
            return false;
        return true;
    }
}
